clear all
set more off 

********************************************************************************
* main rent DD results shown in table 3

********************************************************************************

** near-far dd
local max_dist 600
local iso_dist 250 
local g g 

use near_far_m`max_dist'_i`iso_dist'_`g',clear

di "SPECIFICATION DETAILS"
di "max" "`max_dist'" 
di "iso" "`iso_dist'" 	
di "`g'" 		
gen treated=l250
gen treated_after=treated*(gap>=0)

egen ring_fe=group(building_id l250)

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 & tx250_min_number>0 & tx256_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(ring_fe building_id_year) vce(cl building_id)
	
*  near-near dd

local max_dist 250 
local g g

use near_near_m`max_dist'_i`max_dist'_`g',clear
		
di "SPECIFICATION DETAILS"
di "max" "`max_dist'" 
di "`g'" 	

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0 

* ddd
		
use test_triple_diff_m600_i250_g,clear

egen ring_fe=group(building_id l250)

reghdfe lrent treated l250 treated#l250 listing_year#l250 after_250_treated i.listing_bedrooms i.listing_bathrooms  ///
	if building_sample==1 & tx250_min_number>0 & tx256_min_number>0  ///
	[aweight=building_sample_weight],absorb(ring_fe building_id_year) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & tx250_min_number>0 & tx256_min_number>0

